<?
	define('_VIEW_MODEL_','admin');
	session_start();
	$statu = $_SESSION['statu'];
	require_once '../init.php';
	if(!$statu){
		echo "<script>window.parent.location.href='./index.php'</script>";
	}
	$where       = "";
	$selectstyle = "";
	$namevalue   = "";
	if(isset($page)){
		$page = intval($page);
	}else{
		$page = 1;
	}
	$stat = ($page-1)*$adminusernum;
	if(isset($act) && $act == "searchuser"){
			$selectstyle = $stylename;
			$namevalue   = $selectvalue;
			if($selectstyle == "1"){
				$where = "where `id` = '$namevalue'";
			}
			if($selectstyle == "2"){
				$where = "where `name` = '$namevalue'";
			}
			if($selectstyle == "3"){
				$where = "where `phone` = '$namevalue'";
			}
	}else{
		$act = "all";
	}
	if(isset($aco) && $aco == "updat"){
			$id = intval($id);
			$va = $val == '0'?"1":"0";
			$db->Execute("update {$telper}user set `isphone` = '$va' where `id` = '$id'");
	}
	$num  = $db->GetRow("select count(id) from {$telper}user $where");
	//$pagearray = pageclss($page,$num['count(id)'],);
	if($act == "all"){
		$rs = $db->Execute("select `id`,`name`,`money`,`created`,`phone`,`isphone` from {$telper}user $where order by `created` desc limit $stat,10");
		if(!empty($rs)){
			$memberarray = $rs->GetArray();
		}else{
			$memberarray = false;
		}
	}else{
		$memberarray  = $db->GetRow("select `id`,`name`,`money`,`created`,`phone`,`isphone` from {$telper}user $where ");
		if(empty($memberarray)){
			$memberarray = false;
		}
	}
	$pageObj = new Page($num['count(id)'],$adminusernum,$smartyObj);
	$smartyObj->assign("namevalue",$namevalue);
	$smartyObj->assign("act",$act);
	$smartyObj->assign("selectstyle",$selectstyle);
	$smartyObj->assign("title",$admintitle);
	$smartyObj->assign("moneyname",$moneyname);
	$smartyObj->assign("membertitle",$membertitle);
	$smartyObj->assign("memberarray",$memberarray);
	$smartyObj->display("member.tpl");
?>